public class Solution1752 {
    public boolean check(int[] nums) {
        int a=0;
        for (int i=0;i<nums.length-1;i++){
            if (nums[i]>nums[i+1]){
                a++;
            }
        }
        if (nums[nums.length-1]>nums[0]){
            a++;
        }
        return a<=1;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1752().check(new int[]{3,4,5,1,2}));
    }
}
